/*
 * @Author: Joel
 * @Date: 2025-04-10 14:05:53
 * @LastEditors: Joel
 * @LastEditTime: 2025-04-12 15:45:17
 * @FilePath: /smart-cupping2/usr/board_driver/control.h
 * @Description:
 * Copyright (C) 2025 YiJiaLink, All Rights Reserved.
 * 2025-04-10 14:05:53
 */
#ifndef __CONTROL_H
#define __CONTROL_H

/* 包含头文件代码 */

#include "BAT32G137.h"
#include "gpio.h"
#include "intp.h"

#if defined(__cplusplus)
extern "C"
{
#endif /*_cplusplus*/

    enum CTRL_OUTPUT
    {
        PWR_CTRL,
        VALVE_CTRL,
        FSTCH_CTRL,
        EMS_CTRL,
        OLED_RES,
        OLED_DC,
        OLED_CS,
        IR_CTRL,
        CTRL_MAX
    };
/*PWR_CTRL 硬件连接 */
#define PWR_CTRL_GPIO_PORT PORT4
#define PWR_CTRL_PIN PIN1

/*VALVE_CTRL 硬件连接 */
#define VALVE_CTRL_GPIO_PORT PORT6
#define VALVE_CTRL_PIN PIN2

/*FSTCH_CTRL 硬件连接 */
#define FSTCH_CTRL_GPIO_PORT PORT6
#define FSTCH_CTRL_PIN PIN3

/*EMS_CTRL 硬件连接 */
#define EMS_CTRL_GPIO_PORT PORT13
#define EMS_CTRL_PIN PIN0

/*OLED_RES 硬件连接 */
#define OLED_RES_GPIO_PORT PORT7
#define OLED_RES_PIN PIN1

/*OLED_DC 硬件连接 */
#define OLED_DC_GPIO_PORT PORT7
#define OLED_DC_PIN PIN3

/*OLED_CS 硬件连接 */
#define OLED_CS_GPIO_PORT PORT3
#define OLED_CS_PIN PIN0

/*OLED_SCLK 硬件连接 */
#define OLED_SCLK_GPIO_PORT PORT7
#define OLED_SCLK_PIN PIN0

/*OLED_SDIN硬件连接 */
#define OLED_SDIN_GPIO_PORT PORT7
#define OLED_SDIN_PIN PIN2

/*IR_CTRL 硬件连接 */
#define IR_CTRL_GPIO_PORT PORT0
#define IR_CTRL_PIN PIN0

    /* 功能打包 */
    struct ctrl_func
    {
        /* data */
        void (*device_init)(void);
        void (*ctrl_run)(enum CTRL_OUTPUT ctrl,uint8_t flag);
        void (*ctrl_stop)(enum CTRL_OUTPUT ctrl);

    };

    struct ctrl_func *ctrl_driver_init(void);

#if defined(__cplusplus)
}
#endif /*_cplusplus*/

#endif
/* el psy congroo */
